package com.uoko.common.thread;

public class TestSpinLock {

	private static SpinLock lock = new SpinLock();

	public static void testSpin(String s) {
		lock.lock();
		for (int i = 1; i < 20; i++) {
			System.out.println(s + ":" + i);
			try {
				Thread.sleep(100);
			} catch (InterruptedException e) {
			}
		}
		lock.unlock();
	}

	public static void testSpin2(String s) {
		lock.lock();
		for (int i = 1; i < 20; i++) {
			System.out.println(s + ":" + i);
			try {
				Thread.sleep(100);
			} catch (InterruptedException e) {
			}
		}
		lock.unlock();
	}

//	public static void main(String[] args) {
//		int i = 3;
//		System.out.println(63 >> 6);
//		System.out.println((byte) ((i >> 1) & 0x1));
//		// System.out.println("aaaaaasafashhhhhhhhhhhhhhhhasdfasfasfsafsaaaaaasdfasfdasf".hashCode());
//		// System.out.println("张山开始了");
//		// (new Thread(() -> TestSpinLock.testSpin("张山"))).start();
//		// System.out.println("李四开始了");
//		// (new Thread(() -> TestSpinLock.testSpin("李四"))).start();
//	}

}
